import 'package:flutter_test/flutter_test.dart';
import 'package:logger/logger.dart';
import 'package:logger/logger_platform_interface.dart';
import 'package:logger/logger_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockLoggerPlatform
    with MockPlatformInterfaceMixin
    implements LoggerPlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');

  @override
  Future<void> logE(String tag, String msg) {
    // TODO: implement logE
    throw UnimplementedError();
  }

  @override
  void logI(String tag, String msg) {
    // TODO: implement logI
  }
}

void main() {
  final LoggerPlatform initialPlatform = LoggerPlatform.instance;

  test('$MethodChannelLogger is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelLogger>());
  });

  test('getPlatformVersion', () async {
    Logger loggerPlugin = Logger();
    MockLoggerPlatform fakePlatform = MockLoggerPlatform();
    LoggerPlatform.instance = fakePlatform;

    expect(await loggerPlugin.getPlatformVersion(), '42');
  });
}
